<template>
  <div class="category" scroll="no">
    <el-button type="primary" @click='routeradd'>添加</el-button>
    <el-table
      :data="Category"
      border
      show-overflow-tooltip
      style="width: 100"
      size="medium"
    >
      <el-table-column prop="id" label="ID" width="220"> </el-table-column>
      <el-table-column prop="front_name" label="分类名称" width="220">
      </el-table-column>
      <el-table-column prop="顶级分类" label="分类级别" width="220">
      </el-table-column>
      <el-table-column label="图片" width="220"
        ><image src="wap_banner_url" alt=""></image>
      </el-table-column>
      <el-table-column prop="is_show" label="是否显示" width="220">
        <template slot-scope="scope">
          {{ scope.row.is_show === 1 ? "是" : "否" }}
        </template></el-table-column
      >
      <el-table-column prop="sort_order" label="排序" width="220">
      </el-table-column>
      <el-table-column label="操作" width="220"
        ><template slot-scope="scope">
             <el-button type="primary" size="mini" @click="goEditcategory(scope.row.id)">编辑</el-button> 
          </template>
      </el-table-column>
    </el-table>
  
  </div>
</template>
 
<script>
import { Category } from "../../../../../request/api";
export default {
  data() {
     
    return {
      Category: [],
      data: "",
      
    };
  },
  created() {
    Category().then((res) => {
      this.Category = res.data;
      console.log(this.Category);
    });
  },
  methods:{
    routeradd(){
      this.$router.push('/homepage/addcategory')
    },
      goEditcategory(id){
       console.log(id);
       this.$router.push('/homepage/editcategory/'+ id)
     }
  }
};
</script>
 
<style lang = "less" scoped>
.category {
  width: 100%;
  height: calc(100vh - 70px);
  padding-top: 10px;
  overflow-y: auto;
  box-sizing: border-box;
}
</style>